﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Transformation
{
    /// <summary>
    /// This class contains parameters for a six parameter transformation, which includes a rotate
    /// and translation transformation for x, y and z axis. 
    /// </summary>
    [Serializable]
    public class SixParameterTransformationParameters : ISixParameterTransformationParameters
    {
        /// <summary>
        /// The rotation factor for the x axis.
        /// </summary>
        private double rotationX;

        /// <summary>
        /// The rotation factor for the y axis.
        /// </summary>
        private double rotationY;

        /// <summary>
        /// The rotation factor for the z axis.
        /// </summary>
        private double rotationZ;

        /// <summary>
        /// The translation value for the x axis.
        /// </summary>
        private double translationX;

        /// <summary>
        /// The translation value for the y axis.
        /// </summary>
        private double translationY;

        /// <summary>
        /// The translation value for the z axis.
        /// </summary>
        private double translationZ;

        /// <summary>
        /// Initializes a new instance of the <see cref="SixParameterTransformationParameters"/> class.
        /// </summary>
        public SixParameterTransformationParameters()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SixParameterTransformationParameters"/> class.
        /// </summary>
        /// <param name="parameters">The transformation parameters to clone.</param>
        public SixParameterTransformationParameters(SixParameterTransformationParameters parameters)
        {
            if (parameters == (SixParameterTransformationParameters) null)
            {
                throw new ArgumentNullException("parameters");
            }

            this.rotationX = parameters.RotationX;
            this.rotationY = parameters.RotationY;
            this.rotationZ = parameters.RotationZ;
            this.translationX = parameters.TranslationX;
            this.translationY = parameters.TranslationY;
            this.translationZ = parameters.TranslationZ;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SixParameterTransformationParameters"/> class.
        /// </summary>
        /// <param name="rotationX">The rotation factor for the x axis.</param>
        /// <param name="rotationY">The rotation factor for the y axis.</param>
        /// <param name="rotationZ">The rotation factor for the z axis.</param>
        /// <param name="translationX">The translation value for the x axis.</param>
        /// <param name="translationY">The translation value for the y axis.</param>
        /// <param name="translationZ">The translation value for the z axis.</param>
        public SixParameterTransformationParameters(double rotationX, double rotationY,
                                                    double rotationZ, double translationX, double translationY,
                                                    double translationZ)
        {
            this.rotationX = rotationX;
            this.rotationY = rotationY;
            this.rotationZ = rotationZ;
            this.translationX = translationX;
            this.translationY = translationY;
            this.translationZ = translationZ;
        }

        /// <summary>
        /// Gets or sets the rotation factor for the x axis.
        /// </summary>
        /// <value>The rotation factor for the x axis.</value>
        public double RotationX
        {
            get { return this.rotationX; }
            set { this.rotationX = value; }
        }

        /// <summary>
        /// Gets or sets the rotation factor for the y axis.
        /// </summary>
        /// <value>The rotation factor for the y axis.</value>
        public double RotationY
        {
            get { return this.rotationY; }
            set { this.rotationY = value; }
        }

        /// <summary>
        /// Gets or sets the rotation factor for the z axis.
        /// </summary>
        /// <value>The rotation factor for the z axis.</value>
        public double RotationZ
        {
            get { return this.rotationZ; }
            set { this.rotationZ = value; }
        }

        /// <summary>
        /// Gets or sets the translation value for the x axis.
        /// </summary>
        /// <value>The translation value for the x axis.</value>
        public double TranslationX
        {
            get { return this.translationX; }
            set { this.translationX = value; }
        }

        /// <summary>
        /// Gets or sets the translation value for the y axis.
        /// </summary>
        /// <value>The translation value for the y axis.</value>
        public double TranslationY
        {
            get { return this.translationY; }
            set { this.translationY = value; }
        }

        /// <summary>
        /// Gets or sets the translation value for the z axis.
        /// </summary>
        /// <value>The translation value for the z axis.</value>
        public double TranslationZ
        {
            get { return this.translationZ; }
            set { this.translationZ = value; }
        }
    }
}